<?php
namespace console\controllers;

use Workerman\Worker;
use yii\console\Controller;
define('GLOBAL_START', 1);
require_once  dirname(dirname(dirname(__FILE__))).'/trade/common/config.php';
class GatherController extends Controller
{
    /**
     * 清理过期的历史记录
     */
     
    public function actionStart()
    {

    	$GLOBALS['argv'] = [null, 'start'];
        foreach(glob(dirname(dirname(dirname(__FILE__))).'/trade/application/start_*.php') as $start_file)
        {
            require_once $start_file;
        }
        // 运行所有服务
        Worker::runAll();
    }
    public function actionStartd()
    {

    	$GLOBALS['argv'] = [null, 'start','-d'];
        foreach(glob(dirname(dirname(dirname(__FILE__))).'/trade/application/start_*.php') as $start_file)
        {
            require_once $start_file;
        }

        // 运行所有服务
        Worker::runAll();
    }
    public function actionStop()
    {

    	$GLOBALS['argv'] = [null, 'stop'];
        foreach(glob(dirname(dirname(dirname(__FILE__))).'/trade/application/start_*.php') as $start_file)
        {
            require_once $start_file;
        }

        // 运行所有服务
        Worker::runAll();
    }
}